package com.huawei.appmarket.oobe.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.TypefaceSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.huawei.appgallery.foundation.ui.framework.widget.ObservableScrollView;
import com.huawei.appgallery.foundation.ui.framework.widget.ObservableScrollView.a;
import com.huawei.appgallery.foundation.ui.framework.widget.dialog.dialogactivity.DialogActivity;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse$OOBEAppInfo;
import com.huawei.appmarket.R;
import com.huawei.appmarket.oobe.app.OOBEFlowController;
import com.huawei.appmarket.service.exposure.bean.ExposureDetail;
import com.huawei.secure.android.common.intent.SafeIntent;
import huawei.widget.HwButton;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import o.ayy;
import o.azb;
import o.HcridSession;
import o.ckh;
import o.dgm;
import o.dld;
import o.dle;
import o.dlg;
import o.dli;
import o.dlk;
import o.dll;
import o.dln;
import o.Logger;
import o.ContentManager;
import o.dvt;
import o.dyf;
import o.dyg;
import o.epv;
import o.epw;
import o.CollectCheck;
import o.NetWorkUtil;
import o.evk;
import o.evx;
import o.ll;

@RequiresApi(api = 21)
public class OOBEAppGalleryActivity extends Activity implements OnClickListener, a {
    private TextView ʻ;
    private boolean ʻॱ = false;
    private TextView ʼ;
    private dyf ʼॱ = new dyf();
    private TextView ʽ;
    private ArrayList<StartupResponse$OOBEAppInfo> ʽॱ = new ArrayList();
    private long ʾ = 0;
    private Timer ʿ = new Timer();
    private List<View> ˈ = new ArrayList();
    private ImageView ˊॱ;
    private HwButton ˋ;
    private View ˋॱ;
    private ObservableScrollView ˎ;
    private TextView ˏ;
    private TextView ˏॱ;
    private View ͺ;
    private LinearLayout ॱ;
    private long ॱˊ = 0;
    private View ॱˋ;
    private LinearLayout ॱˎ;
    private TextView ॱॱ;
    private List<dlk> ॱᐝ = new ArrayList();
    private TextView ᐝ;
    private LinearLayout ᐝॱ;

    public static int ˊ(int i) {
        Resources resources = ContentManager.getInstant().getContext().getResources();
        int ॱ = azb.ॱ(null, 0) - (resources.getDimensionPixelSize(R.dimen.oobe_hwcolumn_margin_offset) * 2);
        int dimensionPixelSize = resources.getDimensionPixelSize(R.dimen.margin_m) + epv.ˊ();
        if (i > 1) {
            return (ॱ - (i * dimensionPixelSize)) / (i - 1);
        }
        return 0;
    }

    @RequiresApi(api = 23)
    protected void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        ayy.ˋ().ˎ(getWindow());
        if (dli.ˋ()) {
            if (dld.ˎ().ᐝॱ()) {
                int ʼॱ = dld.ˎ().ʼॱ();
                dld.ˎ().ˏ(ʼॱ);
                if (ʼॱ == 2) {
                    dln o_dln = new dln();
                    o_dln.ˎ(dli.ʼ(this));
                    o_dln.ˏ(dli.ˊ(this).getString("isOpenChannel", "1"));
                    o_dln.ˏ().clear();
                    o_dln.ˏ().add(dld.ˎ().ʿ());
                    if (!dll.ˎ().ˊ(this, o_dln, 1)) {
                        setResult(0);
                        finish();
                        return;
                    }
                    return;
                }
            }
            Logger.ˋ("OOBE", "OOBEAppGalleryActivity onCreate finish: OOBE not support");
            setResult(0);
            finish();
            return;
        }
        requestWindowFeature(1);
        setContentView(R.layout.oobe_activity_oobe_gallery);
        azb.ˏ(findViewById(R.id.oobe_gallery_content));
        if (getActionBar() != null) {
            getActionBar().hide();
        }
        Logger.ˎ("OOBE", "OOBEAppGalleryActivity onCreate ");
        SafeIntent safeIntent = new SafeIntent(getIntent());
        this.ʻॱ = safeIntent.getBooleanExtra("isFromMoreApps", false);
        if (dli.ˋ()) {
            this.ʻॱ = false;
        }
        Logger.ˎ("OOBE", "isFromMoreApps:" + this.ʻॱ);
        if (dli.ˏ(this) && VERSION.SDK_INT < 28) {
            dli.ˊ(this, safeIntent);
        }
        if (dli.ˏ(this)) {
            dli.ˏ("350202", dli.ʽ(this));
        } else {
            dli.ˏ("350207", dli.ʽ(this));
        }
        this.ˎ = (ObservableScrollView) findViewById(R.id.app_container);
        this.ˎ.setScrollStateListener(this);
        this.ॱ = (LinearLayout) findViewById(R.id.oobe_app_layout);
        this.ˏ = (TextView) findViewById(R.id.oobe_install_button);
        this.ʽ = (TextView) findViewById(R.id.back_button);
        this.ˋ = (HwButton) findViewById(R.id.open_hiapp_button);
        this.ʻ = (TextView) findViewById(R.id.close_button);
        this.ͺ = findViewById(R.id.app_container_layout);
        this.ˋॱ = findViewById(R.id.empty_layout);
        this.ˊॱ = (ImageView) findViewById(R.id.next_arrow);
        this.ᐝॱ = (LinearLayout) findViewById(R.id.oobe_install_layout);
        this.ॱˎ = (LinearLayout) findViewById(R.id.oobe_nothanks_layout);
        this.ˋ.setOnClickListener(this);
        this.ʻ.setOnClickListener(this);
        this.ᐝॱ.setOnClickListener(this);
        this.ॱˎ.setOnClickListener(this);
        this.ॱॱ = (TextView) findViewById(R.id.permission_carrier);
        this.ʼ = (TextView) findViewById(R.id.privacy_and_user_agreement);
        this.ᐝ = (TextView) findViewById(R.id.oobe_desc);
        this.ˏॱ = (TextView) findViewById(R.id.oobe_select_deselect);
        this.ˏॱ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ OOBEAppGalleryActivity ॱ;

            {
                this.ॱ = r1;
            }

            public void onClick(View view) {
                if (dld.ˎ().ᐝ().size() == dld.ˎ().ˋ().size()) {
                    this.ॱ.ˎ();
                } else {
                    this.ॱ.ˏ();
                }
            }
        });
        if (dli.ˏ(this)) {
            dld.ˊ();
        }
        ˊ();
        dlg.ˊ(this.ʽॱ, null);
        ॱ();
    }

    private void ˏ() {
        for (dlk ˋ : this.ॱᐝ) {
            ˋ.ˋ(true);
        }
        dld.ˎ().ᐝ().clear();
        dld.ˎ().ᐝ().addAll(dld.ˎ().ˋ());
        ˎ(dld.ˎ().ᐝ().size());
    }

    private void ˎ() {
        for (dlk o_dlk : this.ॱᐝ) {
            if (!o_dlk.ˏ()) {
                o_dlk.ˋ(false);
            }
        }
        dld.ˎ().ᐝ().clear();
        dld.ˎ().ᐝ().addAll(dld.ˎ().ˏ());
        ˎ(dld.ˎ().ᐝ().size());
    }

    private void ˎ(int i) {
        if (this.ᐝ != null) {
            this.ᐝ.setText(getResources().getString(R.string.oobe_app_gallery_title) + getResources().getQuantityString(R.plurals.oobe_selected_num, i, new Object[]{Integer.valueOf(i)}));
        }
        if (this.ˏॱ != null) {
            if (i == dld.ˎ().ˋ().size()) {
                this.ˏॱ.setText(getResources().getString(R.string.oobe_deselect_all));
            } else {
                this.ˏॱ.setText(getResources().getString(R.string.oobe_select_all));
            }
        }
        ᐝ();
    }

    protected void onResume() {
        super.onResume();
        if (dli.ˏ(this)) {
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | 4098);
        }
        if (this.ॱˋ != null) {
            this.ॱˋ.setClickable(true);
        }
        if (dli.ˏ(this)) {
            dld.ˎ().ˎ(false);
        }
    }

    protected void onStop() {
        super.onStop();
        this.ʼॱ.ˎ(dgm.ˎ(this), false);
    }

    protected void onActivityResult(int i, int i2, Intent intent) {
        if (i == 0) {
            if (intent != null) {
                int intExtra = intent.getIntExtra("index", -1);
                if (intExtra >= 0) {
                    dlk o_dlk = (dlk) this.ॱᐝ.get(intExtra);
                    if (o_dlk != null) {
                        o_dlk.ˋ(true);
                    }
                }
            }
        } else if (i == 1) {
            setResult(i2);
            finish();
        } else {
            Logger.e("OOBE", "invalid requestCode");
        }
    }

    protected void onDestroy() {
        super.onDestroy();
    }

    public void onBackPressed() {
        if (!dli.ˏ(this)) {
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.setFlags(268435456);
            intent.addCategory("android.intent.category.HOME");
            startActivity(intent);
        } else if (dli.ˋ()) {
            setResult(-2);
            ʼ();
        } else {
            setResult(0);
            ʽ();
        }
    }

    private void ˎ(TextView textView) {
        Object anonymousClass2;
        int i = 1;
        String string = getString(R.string.oobe_clickable_permission);
        CharSequence spannableString = new SpannableString(getString(R.string.oobe_permission_prompt_v3, new Object[]{this.ˏ.getText(), string}));
        int indexOf = spannableString.toString().indexOf(string);
        if (dld.ˎ().ᐝ().size() <= 0) {
            i = 0;
        }
        if (i != 0) {
            anonymousClass2 = new dle(this, this) {
                final /* synthetic */ OOBEAppGalleryActivity ˋ;

                public void updateDrawState(TextPaint textPaint) {
                    textPaint.setColor(this.ˋ.getResources().getColor(R.color.appgallery_text_color_primary_activated));
                    textPaint.setUnderlineText(false);
                }

                public void ˎ(View view) {
                    this.ˋ.ॱˋ = view;
                    this.ˋ.ˋ(view);
                }
            };
        } else {
            anonymousClass2 = new dle(this, this) {
                final /* synthetic */ OOBEAppGalleryActivity ˎ;

                public void updateDrawState(TextPaint textPaint) {
                    textPaint.setColor(this.ˎ.getResources().getColor(R.color.oobe_permission_while_no_app_selected));
                    textPaint.setUnderlineText(false);
                }

                public void ˎ(View view) {
                }
            };
        }
        spannableString.setSpan(anonymousClass2, indexOf, string.length() + indexOf, 33);
        spannableString.setSpan(new TypefaceSpan(getString(R.string.appgallery_text_font_family_medium)), indexOf, string.length() + indexOf, 33);
        textView.setText(spannableString);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        textView.setHighlightColor(getResources().getColor(R.color.transparent));
    }

    private void ॱ(TextView textView) {
        String string = getString(R.string.oobe_common_privacy);
        String string2 = getString(R.string.oobe_common_user_agreement);
        CharSequence spannableString = new SpannableString(getString(R.string.oobe_privacy_and_user_agreement, new Object[]{getString(R.string.oobe_common_privacy), getString(R.string.oobe_common_user_agreement)}));
        int indexOf = spannableString.toString().indexOf(string);
        int indexOf2 = spannableString.toString().indexOf(string2);
        AnonymousClass1 anonymousClass1 = new dle(this, this) {
            final /* synthetic */ OOBEAppGalleryActivity ॱ;

            public void updateDrawState(TextPaint textPaint) {
                textPaint.setColor(this.ॱ.getResources().getColor(R.color.appgallery_text_color_primary_activated));
                textPaint.setUnderlineText(false);
            }

            public void ˎ(View view) {
                OOBEProtocolActivity.ॱ(this.ॱ);
            }
        };
        AnonymousClass9 anonymousClass9 = new dle(this, this) {
            final /* synthetic */ OOBEAppGalleryActivity ॱ;

            public void updateDrawState(TextPaint textPaint) {
                textPaint.setColor(this.ॱ.getResources().getColor(R.color.appgallery_text_color_primary_activated));
                textPaint.setUnderlineText(false);
            }

            public void ˎ(View view) {
                OOBEProtocolActivity.ˋ(this.ॱ);
            }
        };
        spannableString.setSpan(anonymousClass1, indexOf, string.length() + indexOf, 33);
        spannableString.setSpan(new TypefaceSpan(getString(R.string.appgallery_text_font_family_medium)), indexOf, string.length() + indexOf, 33);
        spannableString.setSpan(anonymousClass9, indexOf2, string2.length() + indexOf2, 33);
        spannableString.setSpan(new TypefaceSpan(getString(R.string.appgallery_text_font_family_medium)), indexOf2, string2.length() + indexOf2, 33);
        textView.setText(spannableString);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        textView.setHighlightColor(getResources().getColor(R.color.transparent));
    }

    private void ˊ() {
        Context ˋ = ContentManager.getInstant().getContext();
        int ˋॱ = dli.ˋॱ(ˋ);
        this.ʽॱ.clear();
        int i = 0;
        for (StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo : dld.ˎ().ʻॱ()) {
            int i2;
            Object obj = (dli.ˊ(ˋ, startupResponse$OOBEAppInfo.ˎ()) || (!HcridSession.ˋ().appsstoreGMSSupport() && startupResponse$OOBEAppInfo.ˊॱ() == 1)) ? 1 : null;
            if (obj == null) {
                this.ʽॱ.add(startupResponse$OOBEAppInfo);
                i2 = i + 1;
                if (i2 >= ˋॱ) {
                    break;
                }
            } else {
                i2 = i;
            }
            i = i2;
        }
        dld.ˎ().ᐝ().clear();
        dld.ˎ().ͺ().clear();
        dld.ˎ().ˋ().clear();
        dld.ˎ().ˋ().addAll(this.ʽॱ);
    }

    private void ॱ() {
        if (dli.ˏ(this)) {
            if (dli.ˋ()) {
                this.ʽ.setText(R.string.oobe_back);
                this.ˏ.setText(R.string.oobe_next);
            } else {
                this.ˊॱ.setVisibility(8);
                if (this.ʻॱ) {
                    this.ʽ.setText(R.string.oobe_back);
                    this.ˏ.setText(R.string.oobe_install);
                } else {
                    this.ʽ.setText(R.string.oobe_later_v2);
                    this.ˏ.setText(R.string.oobe_next);
                }
            }
            ˊ(this.ʽॱ);
            return;
        }
        this.ʽ.setText(R.string.oobe_no_thanks);
        this.ˏ.setText(R.string.oobe_install);
        this.ˊॱ.setVisibility(8);
        if (CollectCheck.isEmpty(this.ʽॱ)) {
            this.ͺ.setVisibility(8);
            this.ˋॱ.setVisibility(0);
            dli.ͺ(this);
            return;
        }
        ˊ(this.ʽॱ);
    }

    private void ˊ(List<StartupResponse$OOBEAppInfo> list) {
        View view = null;
        int size = list.size();
        this.ॱᐝ.clear();
        this.ˈ.clear();
        ˋ();
        int i = 0;
        while (i < size) {
            dlk o_dlk = new dlk();
            final StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo = (StartupResponse$OOBEAppInfo) list.get(i);
            if (i % 3 == 0) {
                view = o_dlk.ˏ(this);
                this.ॱ.addView(view);
            }
            View view2 = view;
            o_dlk.ˎ(new OnCheckedChangeListener(this) {
                final /* synthetic */ OOBEAppGalleryActivity ॱ;

                public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                    if (z) {
                        startupResponse$OOBEAppInfo.ˊ(true);
                        dld.ˎ().ᐝ().add(startupResponse$OOBEAppInfo);
                    } else {
                        startupResponse$OOBEAppInfo.ˊ(false);
                        dld.ˎ().ᐝ().remove(startupResponse$OOBEAppInfo);
                    }
                    this.ॱ.ˎ(dld.ˎ().ᐝ().size());
                }
            });
            view = o_dlk.ˎ(this, 3, i, ˊ(3), startupResponse$OOBEAppInfo);
            if (view2 != null) {
                view.setTag(startupResponse$OOBEAppInfo);
                this.ˈ.add(view);
                view2.addView(view);
                this.ॱᐝ.add(o_dlk);
                view.setOnClickListener(new evx(this) {
                    final /* synthetic */ OOBEAppGalleryActivity ˎ;

                    public void ˋ(View view) {
                        Intent intent = new Intent(this.ˎ, OOBEAppDetailActivity.class);
                        intent.putExtra("detailId", startupResponse$OOBEAppInfo.ˊ());
                        intent.putExtra("index", i);
                        intent.putExtra("checked", startupResponse$OOBEAppInfo.ॱॱ());
                        try {
                            this.ˎ.startActivityForResult(intent, 0);
                        } catch (ActivityNotFoundException e) {
                            Logger.ˋ("OOBE", "ActivityNotFoundException :" + e.toString());
                        }
                        List arrayList = new ArrayList();
                        arrayList.add(startupResponse$OOBEAppInfo);
                        this.ˎ.ˋ(arrayList);
                    }
                });
            }
            i++;
            view = view2;
        }
        ᐝ();
        ॱ(this.ʼ);
        this.ˎ.post(new Runnable(this) {
            final /* synthetic */ OOBEAppGalleryActivity ˏ;

            {
                this.ˏ = r1;
            }

            public void run() {
                this.ˏ.ˊॱ();
            }
        });
    }

    private void ˋ() {
        boolean z = dli.ˏ(this) && dli.ˋ() && dld.ˎ().ʽॱ();
        dld.ˎ().ˏ().clear();
        for (StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo : dld.ˎ().ˋ()) {
            if (z) {
                if (startupResponse$OOBEAppInfo.ॱॱ()) {
                    dld.ˎ().ᐝ().add(startupResponse$OOBEAppInfo);
                }
            } else if (startupResponse$OOBEAppInfo.ˏॱ() == 2) {
                startupResponse$OOBEAppInfo.ˊ(true);
                dld.ˎ().ᐝ().add(startupResponse$OOBEAppInfo);
            } else if (startupResponse$OOBEAppInfo.ˏॱ() == 3) {
                dld.ˎ().ˏ().add(startupResponse$OOBEAppInfo);
                startupResponse$OOBEAppInfo.ˊ(true);
                dld.ˎ().ᐝ().add(startupResponse$OOBEAppInfo);
            } else {
                startupResponse$OOBEAppInfo.ˊ(false);
            }
        }
        if (!z) {
            ॱॱ();
        }
        ˎ(dld.ˎ().ᐝ().size());
    }

    private void ॱॱ() {
        int ˋॱ = dld.ˎ().ˋॱ() - dld.ˎ().ᐝ().size();
        if (ˋॱ > 0) {
            int i = ˋॱ;
            for (StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo : dld.ˎ().ˋ()) {
                if (startupResponse$OOBEAppInfo.ॱॱ()) {
                    ˋॱ = i;
                } else {
                    startupResponse$OOBEAppInfo.ˊ(true);
                    dld.ˎ().ᐝ().add(startupResponse$OOBEAppInfo);
                    ˋॱ = i - 1;
                    if (ˋॱ <= 0) {
                        return;
                    }
                }
                i = ˋॱ;
            }
        }
    }

    private void ᐝ() {
        boolean z = dld.ˎ().ᐝ().size() > 0 || (dli.ˏ(this) && !this.ʻॱ);
        if (z) {
            this.ˏ.setTextColor(getResources().getColor(R.color.appgallery_text_color_primary));
            this.ᐝॱ.setClickable(true);
        } else {
            this.ˏ.setTextColor(getResources().getColor(R.color.oobe_install_while_no_app_selected));
            this.ᐝॱ.setClickable(false);
        }
        ˎ(this.ॱॱ);
    }

    private void ˏ(Context context, String str, ckh.a aVar) {
        String ˋ = NetWorkUtil.rebuildWifiKey(getResources().getString(R.string.reserve_dlg_content_new_ex));
        new DialogActivity.a(context, "OOBEShowInstallWayDialog").ˏ(getResources().getString(R.string.reserve_dlg_title_new_ex)).ॱ(String.format(Locale.ENGLISH, ˋ, new Object[]{str})).ˋ(-1, NetWorkUtil.rebuildWifiKey(getResources().getString(R.string.oobe_install_wlan))).ˋ(-2, getResources().getString(R.string.oobe_install_now)).ˏ(aVar).ˎ();
    }

    public void onClick(View view) {
        if (view.getId() == R.id.oobe_install_layout) {
            ʻ();
        } else if (view.getId() == R.id.cancel_button || view.getId() == R.id.close_button) {
            dld.ˎ().ᐝ().clear();
            finish();
        } else if (view.getId() == R.id.oobe_nothanks_layout) {
            if (dli.ˏ(this) && dli.ˋ()) {
                setResult(-2);
                ʼ();
                return;
            }
            setResult(0);
            ʽ();
        } else if (view.getId() == R.id.open_hiapp_button) {
            startActivity(getPackageManager().getLaunchIntentForPackage(getPackageName()));
            finish();
        } else {
            Logger.e("OOBE", "v.getId()=" + view.getId());
        }
    }

    private void ʻ() {
        if (dli.ˋ() && dli.ˏ(this)) {
            dld.ˎ().ʻ(true);
        }
        if (dld.ˎ().ᐝ().isEmpty()) {
            if (dli.ˋ() && dli.ˏ(this)) {
                evk.ˏ(this, R.string.oobe_toast_while_user_select_none, 0).ˋ();
            }
            setResult(0);
            ʽ();
            return;
        }
        this.ॱˊ = 0;
        dld.ˎ().ͺ().clear();
        dld.ˎ().ͺ().addAll(dld.ˊ(this, dld.ˎ().ᐝ()));
        for (StartupResponse$OOBEAppInfo ʽ : dld.ˎ().ͺ()) {
            try {
                this.ॱˊ += Long.parseLong(ʽ.ʽ());
            } catch (NumberFormatException e) {
                Logger.e("OOBE", "OOBEAppGalleryActivity NumberFormatException=" + e.getMessage());
            }
        }
        ͺ();
    }

    private void ʽ() {
        dld.ˎ().ᐝ().clear();
        if (!dli.ˏ(this)) {
            if (!dli.ˊ(this).getBoolean("notificationNotRemovable", false)) {
                dli.ͺ(this);
            }
            dli.ˏ("350209", dli.ʽ(this));
        } else if (this.ʻॱ) {
            dli.ˏ("350211", dli.ʽ(this));
        } else {
            dld.ˎ().ˎ(true);
            dli.ˏ("350208", dli.ʽ(this));
        }
        finish();
    }

    private void ʼ() {
        dld.ˎ().ᐝ().clear();
        dld.ˎ().ʻ(false);
        finish();
    }

    private void ˋ(View view) {
        if (dld.ˎ().ᐝ().isEmpty()) {
            Logger.ˎ("OOBE", "OOBEAppGalleryActivity Install list is empty");
            if (view.getBackground() != null) {
                view.getBackground().setAlpha(178);
                return;
            }
            return;
        }
        startActivity(new Intent(this, OOBEAppPermissionActivity.class));
        view.setClickable(false);
    }

    private void ͺ() {
        dld.ˎ().ॱ(4);
        int ॱ = dvt.ॱ(this);
        if (ॱ == 1 || ॱ == 2) {
            ˏ(this, epw.ˊ(this.ॱˊ), new ckh.a(this) {
                final /* synthetic */ OOBEAppGalleryActivity ˊ;

                {
                    this.ˊ = r1;
                }

                public void ˏ(AlertDialog alertDialog, DialogActivity.a aVar, int i) {
                    if (-1 == i) {
                        this.ˊ.ˋॱ();
                    } else if (-2 == i) {
                        dld.ˎ().ॱ(7);
                        this.ˊ.ˋॱ();
                    } else {
                        Logger.e("OOBE", "invalid button:" + i);
                    }
                }
            });
        } else {
            ˋॱ();
        }
    }

    private void ˋॱ() {
        if (dli.ˏ(this)) {
            setResult(-1);
            finish();
            return;
        }
        Intent intent = new Intent("com.huawei.appmarket.oobe.ACTION_NOTIFICATION_FLOW_FINISHED");
        intent.setClass(this, OOBEFlowController.class);
        ll.ˏ(this).ˋ(intent);
        dli.ͺ(this);
        finish();
    }

    public void ˋ(ObservableScrollView observableScrollView, int i) {
        if (i == 0) {
            ˊॱ();
        }
    }

    private void ˋ(List<StartupResponse$OOBEAppInfo> list) {
        int ˎ = dgm.ˎ(this);
        dyg ॱ = dyg.ॱ();
        for (StartupResponse$OOBEAppInfo ˊ : list) {
            ExposureDetail ˎ2 = ExposureDetail.ˎ(ˊ.ˊ());
            if (ˎ2 != null) {
                ˎ2.ˊ("oobe");
                ॱ.ˎ(ˎ2, ˎ);
            }
        }
        this.ʼॱ.ॱ(ॱ, ˎ, false);
    }

    private long ˏॱ() {
        return this.ʾ;
    }

    private void ˊॱ() {
        this.ʾ = System.currentTimeMillis();
        this.ʿ.schedule(new TimerTask(this) {
            final /* synthetic */ OOBEAppGalleryActivity ॱ;

            {
                this.ॱ = r1;
            }

            public void run() {
                if (System.currentTimeMillis() - this.ॱ.ˏॱ() >= 1000) {
                    this.ॱ.ॱˊ();
                }
            }
        }, 1000);
    }

    private void ॱˊ() {
        List arrayList = new ArrayList();
        for (View view : this.ˈ) {
            if (this.ʼॱ.ˎ(view) && (view.getTag() instanceof StartupResponse$OOBEAppInfo)) {
                arrayList.add((StartupResponse$OOBEAppInfo) view.getTag());
            }
        }
        ˋ(arrayList);
    }
}
